<?php 
session_start();include "conn.php";
?>
<?php  include("admin.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Bios 管理中心 </title>
<link href="../css/control.css" rel="stylesheet" type="text/css" />
</head>

<body >
<a name="top" id="top"></a>
<div id="all"><!--Wrap start //-->
<div id="main" class="clearfix"><!--main start //-->
<div id="top-1"><?php include_once('blog_top_btn.php');?>
</div>
<!--Content for  id "submenu" Goes Here //-->
<div id="submenu">
<?php include_once('tagcloud_main_btn.php');?>
  </div>
 <!--Content for  id "contact" Goes Here //-->
 <div id="contact-add">
 
 
 
 <script language="javascript">
function check(form){
if (document.form1.title.value=="")
{alert("請填寫 標題！");document.form1.title.focus();return false;}
}
</script>




<?php
//文件名。。。

$webname="tagcloud"; 
$linkname="tagcloud-main"; 
?>

<?php 









$id=make_safe($_GET["id"]);

//echo $data;
$action=make_safe($_GET["action"]);
$BigClassName=make_safe($_POST["BigClassName"]);
$BigClassName2=make_safe($_POST["BigClassName2"]);
$BigClassName3=make_safe($_POST["BigClassName3"]);
$BigClassName4=make_safe($_POST["BigClassName4"]);
$BigClassName5=make_safe($_POST["BigClassName5"]);
$BigClassName6=make_safe($_POST["BigClassName6"]);
$lb=make_safe($_POST["lb"]);


$mastereditname=$_SESSION["mastereditname2"];
$editname2=$_SESSION["editname2"];
$addname=$_SESSION["username2"];


$enBigClassName=make_safe($_POST["enBigClassName"]);
$SmallClassName=make_safe($_POST["SmallClassName"]);
$enSmallClassName=make_safe($_POST["enSmallClassName"]);
$title=make_safe($_POST["title"]);
$entitle=make_safe($_POST["entitle"]);
$isok=1;
$hits=0;
//$addtime=make_safe($_POST["addtime"]);
$addtime=$data2;
$addtime2=$data3;
$senttime=$data2;
$user=make_safe($_POST["user"]);
$content=$_POST["content"];
$encontent=$_POST["encontent"];
$oldimages=make_safe($_POST["oldimages"]);
$oldimages2=make_safe($_POST["oldimages2"]);
$oldimages3=make_safe($_POST["oldimages3"]);
$oldimages4=make_safe($_POST["oldimages4"]);
$oldimages5=make_safe($_POST["oldimages5"]);
$oldimages6=make_safe($_POST["oldimages6"]);
$oldimages7=make_safe($_POST["oldimages7"]);
$oldimages8=make_safe($_POST["oldimages8"]);


include("check.php");




$path = 'upfiles/'. $_FILES['images']['name'];
$type=strstr($path,'.');
$path2 ='upfiles/'.$data."-1".$type;

$path3 = 'upfiles/'. $_FILES['images2']['name'];
$type3=strstr($path3,'.');
$path4 ='upfiles/'.$data."-2".$type3;

$path5 = 'upfiles/'. $_FILES['images3']['name'];
$type5=strstr($path5,'.');
$path6 ='upfiles/'.$data."-3".$type5;

$path7 = 'upfiles/'. $_FILES['images4']['name'];
$type7=strstr($path7,'.');
$path8 ='upfiles/'.$data."-4".$type7;

$path9 = 'upfiles/'. $_FILES['images5']['name'];
$type9=strstr($path9,'.');
$path10 ='upfiles/'.$data."-5".$type9;

$path11 = 'upfiles/'. $_FILES['images6']['name'];
$type11=strstr($path11,'.');
$path12 ='upfiles/'.$data."-6".$type11;

$path13 = 'upfiles/'. $_FILES['images7']['name'];
$type13=strstr($path13,'.');
$path14 ='upfiles/'.$data."-7".$type13;

$path15 = 'upfiles/'. $_FILES['images8']['name'];
$type15=strstr($path15,'.');
$path16 ='upfiles/'.$data."-8".$type15;



$type=strtolower($type); 
$type3=strtolower($type3); 
$type5=strtolower($type5); 
$type7=strtolower($type7); 
$type9=strtolower($type9); 
$type11=strtolower($type11); 
$type13=strtolower($type13);
$type15=strtolower($type15);


 
//增加数据
if($action=="add"){
	
if($type==".jpg" or $type==".jpge"  or $type==".gif" or $type==".doc" or $type==".xls" or $type==".bmp" or $type==".pdf" ){
move_uploaded_file($_FILES['images']['tmp_name'],$path2);

$aa=getimagesize($path2);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path2);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path2);
    $t->createImg(115,115);

$aa=getimagesize($path2);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;

$resizeimage = new resizeimage($path2, $weight1, $height1, "0","big/".$path2);
if($path2 !='upfiles/'.$data."-1"){unlink($path2);}
}//上传图片
else
{
$path2="";
}


if($type3==".jpg"  or $type3==".jpge" or $type3==".gif" or $type3==".doc" or $type3==".xls" or $type3==".bmp" or $type3==".pdf" ){
move_uploaded_file($_FILES['images2']['tmp_name'],$path4);

$aa=getimagesize($path4);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path4);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path4);
    $t->createImg(115,115);

$aa=getimagesize($path4);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path4, $weight1, $height1, "0","big/".$path4);
if($path4 !='upfiles/'.$data."-2"){unlink($path4);}

}//上传图片
else
{
$path4="";
}

if($type5==".jpg"  or $type5==".jpge" or $type5==".gif" or $type5==".doc" or $type5==".xls" or $type5==".bmp" or $type5==".pdf" ){
move_uploaded_file($_FILES['images3']['tmp_name'],$path6);

$aa=getimagesize($path6);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path6);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path6);
    $t->createImg(115,115);

$aa=getimagesize($path6);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path6, $weight1, $height1, "0","big/".$path6);
if($path6 !='upfiles/'.$data."-3"){unlink($path6);}
}//上传图片
else
{
$path6="";
}


if($type7==".jpg"  or $type7==".jpge" or $type7==".gif" or $type7==".doc" or $type7==".xls" or $type7==".bmp" or $type7==".pdf" ){
move_uploaded_file($_FILES['images4']['tmp_name'],$path8);

$aa=getimagesize($path8);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path8);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path8);
    $t->createImg(115,115);


$aa=getimagesize($path8);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path8, $weight1, $height1, "0","big/".$path8);
if($path8 !='upfiles/'.$data."-4"){unlink($path8);}

}//上传图片
else
{
$path8="";
}


if($type9==".jpg"  or $type9==".jpge" or $type9==".gif" or $type9==".doc" or $type9==".xls" or $type9==".bmp" or $type9==".pdf" ){
move_uploaded_file($_FILES['images5']['tmp_name'],$path10);

$aa=getimagesize($path10);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path10);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path10);
    $t->createImg(115,115);

$aa=getimagesize($path10);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path10, $weight1, $height1, "0","big/".$path10);
if($path10 !='upfiles/'.$data."-5"){unlink($path10);}


}//上传图片
else
{
$path10="";
}

if($type11==".jpg"  or $type11==".jpge" or $type11==".gif" or $type11==".doc" or $type11==".xls" or $type11==".bmp" or $type11==".pdf" ){
move_uploaded_file($_FILES['images6']['tmp_name'],$path12);

$aa=getimagesize($path12);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
if($weight>=$height){$weight1=115;$height1=115*$height/$weight;}
if($height>=$weight){$height1=115;$weight1=115*$weight/$height;}

$t = new ThumbHandler();
$t->setSrcImg($path12);
    $t->setCutType(1);//这一句就OK了
    $t->setDstImg("pic/".$path12);
    $t->createImg(115,115);

$aa=getimagesize($path12);
$weight=$aa["0"];////获取图片的宽
$height=$aa["1"];///获取图片的高
//if($weight>=$height){$weight1=600;$height1=600*$height/$weight;}
//if($height>=$weight){$height1=400;$weight1=400*$weight/$height;}
$height1=400;$weight1=400*$weight/$height;
$resizeimage = new resizeimage($path12, $weight1, $height1, "0","big/".$path12);
if($path12 !='upfiles/'.$data."-6"){unlink($path12);}


}//上传图片
else
{
$path12="";
}

if($type13==".jpg"  or $type13==".jpge" or $type13==".gif" or $type13==".doc" or $type13==".xls" or $type13==".bmp" or $type13==".pdf" ){
move_uploaded_file($_FILES['images7']['tmp_name'],$path14);
$resizeimage = new resizeimage($path14, "200", "100", "0","pic/".$path14);
}//上传图片
else
{
$path14="";
}


if($type15==".jpg"  or $type15==".jpge" or $type15==".gif" or $type15==".doc" or $type15==".xls" or $type15==".bmp" or $type15==".pdf" ){
move_uploaded_file($_FILES['images8']['tmp_name'],$path16);
$resizeimage = new resizeimage($path16, "200", "100", "0","pic/".$path16);
}//上传图片
else
{
$path16="";
}

$sql="Insert Into ".$webname." (title,entitle,content,BigClassName,BigClassName2,lb,mastereditname,editname2,addname,isok,hits,addtime,addtime2,images,images2,images3,images4,images5,images6,images7,images8) Values('$title','$entitle','$content','$BigClassName','$BigClassName2','$lb','$mastereditname','$editname2','$addname','$isok','$hits','$addtime','$addtime2','$path2','$path4','$path6','$path8','$path10','$path12','$path14','$path16')";
$result=mysql_query($sql);

echo "<script> alert('增加成功！');window.location.href='".$linkname.".php';</script>";
}




?>







 
<form method="post" enctype="multipart/form-data" name="form1" onSubmit="return CheckForm();" action="?action=add" target="_self">
 <table border="0" cellpadding="0" cellspacing="0" >
     <tr>
       <td>標簽內容：
         
         <input name="title" type="text" class="contact_add-tit-keyin"  /></td>
     </tr>
     
	 
   </table>
 
 

 <table border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td><input onClick="return check(form);" type="submit" name="Submit" value="提交保存" class="input"></td>
  </tr>
</table>
</form>




</div>
 </div><!-- main end //-->
</div><!--Wrap end //-->

<div id="botton">
 <?php include_once('blog_botton_btn.php');?>
</div>
</body>
</html>
